#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT(BatAlign, 1.00, jingquanlim@gmail.com)
AM_INIT_AUTOMAKE(BatAlign,1.00)
AC_CONFIG_SRCDIR([src/crc32.h])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC

# Checks for libraries.

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([limits.h malloc.h stddef.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_C_VOLATILE
AC_CHECK_TYPES([ptrdiff_t])

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_SETVBUF_REVERSED
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([floor gettimeofday memmove memset pow socket sqrt strchr strdup strtoul])
AC_MSG_CHECKING([Checking for SIMD support and for a gcc bug...])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -msse2"
AC_TRY_COMPILE(	[#include <emmintrin.h>;#include <mmintrin.h>;],
		[__m128i r; unsigned a; _mm_srli_epi32(r,a);],
		AC_MSG_RESULT(OK...)
		AC_DEFINE([MMX],[1],[SIMD instructions supported..]),
		AC_MSG_RESULT(This version of C does not support intrinsics. See the documentation for fixes. Compiling the slower non-MMX version... )
	      )
CFLAGS="$save_CFLAGS"
AC_OUTPUT(Makefile src/Makefile)
